Robot control for avoiding singular configurations

ABSTRACT

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for avoiding singular configurations of a robot. A singular configuration of the robot is obtained. A location of an end effector of the robot when the robot is in the singular configuration is determined. For each of a plurality of voxels in a workcell, a distance from the voxel to the location of the end effector when the robot is in the singular configuration is computed. A negative potential gradient of the computed distance is computed. Control rules are generated, wherein the control rules, when followed by the robot, offset the trajectory of the robot according to the negative potential gradient.

BACKGROUND

This specification relates to robotics, and more particularly tocontrolling robotic movements.

Robotics control refers to scheduling the physical movements of robotsin order to perform tasks. For example, an industrial robot that buildscars can be programmed to first pick up a car part and then weld the carpart onto the frame of the car. Each of these actions can themselvesinclude dozens or hundreds of individual movements by robot motors andactuators.

Robotics planning has traditionally required immense amounts of manualprogramming in order to meticulously dictate how the robotic componentsshould move in order to accomplish a particular task. Manual programmingis tedious, time-consuming, and error prone. In addition, a schedulethat is manually generated for one workcell can generally not be usedfor other workcells. In this specification, a workcell is the physicalenvironment in which a robot will operate. Workcells have particularphysical properties, e.g., physical dimensions, that impose constraintson how robots can move within the workcell. Thus, a manually programmedschedule for one workcell may be incompatible with a workcell havingdifferent robots, a different number of robots, or different physicaldimensions.

Some robots can be programmed to perform online adaptation processes inorder to react to changing situations in a workcell. To do so, a robotcan dynamically compute a desired location and position in Cartesianspace and then use inverse kinematics to determine the joint velocitiesthat are needed to achieve the desired location and position.

However, such online adaptation processes often run into problematicconfigurations that are known as singular configurations. In thisspecification, a singular configuration is a configuration of the jointsin the robot that severely limits control in one or more degrees offreedom. Often this means that velocity in one Cartesian degree offreedom is difficult or impossible or requires a disproportionate amountof joint velocity to achieve.

Singular configurations are problematic because they introduceuncertainty, delays, and safety risks into a robot plan. They slow downthe robotics process because often high joint velocities are required tohandle them that result in the end effector moving slowly in Cartesianspace.

SUMMARY

This specification describes how a system can precompute singularconfigurations for a particular robot and automatically avoid singularconfigurations at runtime.

Particular embodiments of the subject matter described in thisspecification can be implemented so as to realize one or more of thefollowing advantages. The singular configurations and control rules aredetermined prior to execution. During execution, the control rulesensure that the trajectory of the robot avoids singular configurations.The determination of the singular configurations is computationallyexpensive. In comparison, the enforcement of the control rules issignificantly less expensive in terms of computation. By determining thesingular configuration and the control rules prior to execution, thesingular configurations can be automatically avoided during executionwithout introducing any significant delay. As such, uncertainty, delays,and safety risks related to singular configurations can be avoidedwithout introducing any significant delay. This improves the speed andsafety of robotic operations. In addition, singularity avoidance canoccur in a deterministic time frame, which allows the singularityavoidance process to be run online in hard real time systems.

The enforcement of the control rules is not computationally expensiveand can therefore be done online without introducing any significantdelay. The singular configurations can thus be automatically avoidedduring execution without introducing any significant delay. Thisimproves the speed and reactivity of robotic operations, as well as thereliability and safety. The control rules allow even a robot with hardreal-time constraints to dynamically account for and avoid singularconfigurations, even when computing singular configurations is notpossible at runtime.

Moreover, the control rules can be enforced at a low level of thesoftware stack. Lower levels generally have better real-timeperformances than higher levels of the software stack. In particular,the control rules can be enforced downstream of motion planning.Offsetting the trajectory according to a negative potential gradient issignificantly less expensive in terms of computation than computing atrajectory that avoids singular configurations during motion planning.As such, the singular configurations can be automatically avoided duringexecution without introducing any significant delay. This enables onlinetrajectory planners to perform singular configuration avoidance in hardreal time systems.

The details of one or more embodiments of the subject matter of thisspecification are set forth in the accompanying drawings and thedescription below. Other features, aspects, and advantages of thesubject matter will become apparent from the description, the drawings,and the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram that illustrates an example system for controlling arobot.

FIG. 2 is a flowchart of an example process for configuring a robot toavoid singular configurations at runtime.

FIG. 3 is an illustration of a workcell of a robot.

FIG. 4 is an illustration of a potential field in the neighborhood of asingular configuration of the robot.

FIG. 5A illustrates a trajectory of the robot according to a motionplan.

FIG. 5B illustrates the trajectory of the robot adjusted according tothe negative potential gradient.

FIG. 6 is a flowchart of an example process for automatically avoidingsingular configurations at runtime.

FIG. 7 is a flowchart of another example process for configuring a robotto avoid singular configurations at runtime.

FIG. 8 is a flowchart of another example process for automaticallyavoiding singular configurations at runtime.

Like reference numbers and designations in the various drawings indicatelike elements.

DETAILED DESCRIPTION

FIG. 1 is a diagram that illustrates an example system 100. The system100 is an example of a system that can implement the online roboticcontrol techniques described in this specification.

The system 100 includes a number of functional components, including anonline execution system 110 and a robot interface subsystem 160. Each ofthese components can be implemented as computer programs installed onone or more computers in one or more locations that are coupled to eachother through any appropriate communications network, e.g., an intranetor the Internet, or combination of networks.

In general, the online execution system 110 provides commands 155 to beexecuted by the robot interface subsystem 160, which drives a robot,e.g., robot 173, in a workcell 170. A workcell is the physicalenvironment in which a robot will operate. Workcells have particularphysical properties, e.g., physical dimensions that impose constraintson how robots can move within the workcell.

In order to compute the commands 155, the online execution system 110consumes status messages 135 generated by the robot 173 and onlineobservations 145 made by one or more sensors 171 a-n making observationswithin the workcell 170. A robot can have multiple sensors, and thesensors can be mounted on stationary or movable surfaces in the workcell170.

The online execution system 110 issues commands 155 to the robotinterface system 160 in order to actually drive the movements of themoveable components, e.g., the joints, of the robot 173. In someimplementations, the robot interface subsystem 160 provides ahardware-agnostic interface so that the commands 155 issued by onsiteexecution engine 150 are compatible with multiple different versions ofrobots. During execution the robot interface subsystem 160 can reportstatus messages 135 back to the online execution system 110 so that theonline execution system 150 can make online adjustments to the robotmovements, e.g., due to local faults or other unanticipated conditions.

The robot interface subsystem 160 and the online execution system 110can operate according to different timing constraints. In someimplementations, the robot interface subsystem 160 is a real-timesoftware control system with hard real-time requirements. Real-timesoftware control systems are software systems that are required toexecute within strict timing requirements to achieve normal operation.The timing requirements often specify that certain actions must beexecuted or outputs must be generated within a particular time window inorder for the system to avoid entering a fault state. In the faultstate, the system can halt execution or take some other action thatinterrupts normal operation.

The online execution system 110, on the other hand, typically has moreflexibility in operation. In other words, the online execution system110 may, but need not, provide a command 155 within every real-time timewindow under which the robot interface subsystem 160 operates. However,in order to provide the ability to make sensor-based reactions, theonline execution system 110 may still operate under strict timingrequirements. In a typical system, the real-time requirements of therobot interface subsystem 160 require that the robots provide a commandperiodically, such as every 5 milliseconds, while the onlinerequirements of the online execution system 110 specify that the onlineexecution system 110 should provide a command 155 to the robot interfacesubsystem 160 at a lower frequency, such as every 20 milliseconds orevery second. However, even if such a command is not received within theonline time window, the robot interface subsystem 160 need notnecessarily enter a fault state.

Thus, in this specification, the term online refers to both the time andrigidity parameters for operation. The time windows are larger thanthose for the real-time robot interface subsystem 160, and there istypically more flexibility when the timing constraints are not met.

The system 100 can also optionally include an offline planner 120. Theoverall goal of the offline planner 120 is to generate, from adefinition of one or more tasks to be performed, a schedule that will beexecuted by the robot 170 a to accomplish the tasks. In thisspecification, a schedule is data that assigns each task to at least onerobot. A schedule also specifies, for each robot, a sequence of actionsto be performed by the robot. A schedule also includes dependencyinformation, which specifies which actions must not commence untilanother action is finished. A schedule can specify start times foractions, end times for actions, or both.

The offline planning process is typically computationally expensive.Thus, in some implementations, the offline planner 120 is implemented bya cloud-based computing system comprising many, possibly thousands, ofcomputers. The offline planner 120 is thus commonly physically remotefrom a facility that houses the workcell 170. On the other hand, theonline execution engine 110 is typically local to the facility thathouses the workcell 170.

This arrangement thus provides three different computing zones. Theoffline planner 120 can use massive cloud-based computing resources toconsider many possibilities for scheduling tasks, while also allowingfor online reaction to unanticipated events by the online executionengine 150, while also providing the precision and real-time safetymechanisms of the robot interface subsystem 160. In execution, the robot173 generally continually executes the commands specified explicitly orimplicitly by motion plans to perform the various tasks or transitionsof the motion plan. The robot can be a real-time robot, which means thatthe robot is programmed to continually execute its commands according toa highly constrained timeline. It also means that the robot isguaranteed to finish its computation within a fixed time frame. Forexample, the robot can expect a command from the robot interfacesubsystem 160 at a particular frequency, e.g., 100 Hz or 1 kHz. If therobot does not receive a command that is expected, the robot can enter afault mode and stop operating.

A singular configuration database 122 includes a precomputed number ofsingular configurations. The data enumerating the singularconfigurations can be downloaded over the internet during the robotinitialization. The data enumerating the singular configurations canalso be pre-downloaded by a manufacturer of the robot.

The system 100 can also include an offline singular configurationcomputer 180. The offline singular configuration computer 180 computessingular configurations of the robot 170 a and generates control rules182 for automatically avoiding the singular configurations during themovement of the robot. The offline singular configuration computer 180can also store the singular configurations of the robot in the singularconfirmation database 122.

In execution, the singular configuration controller 152 receives aninitial Cartesian trajectory in the Cartesian space. For example, theonsite execution engine 150 (e.g., an online motion planner) sendsCartesian goals occasionally or periodically (e.g., at a 1 Hzfrequency). Alternatively, the onsite execution engine 150 sends amotion plan that defines a sequence of Cartesian goals that the robotmust take to accomplish a task. The robot interface subsystem 160 (e.g.,the real-time software control system) generates the initial Cartesiantrajectory based on the Cartesian goals. This initial Cartesiantrajectory interpolates between the previously received Cartesian goaland the newly received Cartesian goal. The initial Cartesian trajectoryis defined by a sequence of Cartesian-space poses. Each Cartesian-spacepose defines the location of an end effector of the robot in theworkcell. The initial Cartesian trajectory might pass through asingularity point. The initial Cartesian trajectory output by the robotinterface subsystem 160 is passed through the singular configurationcontroller 152. The singular configuration controller 152 modifies theinitial Cartesian trajectory to avoid singular configurations. Morespecifically, the singular configuration controller 152 enforces thecontrol rules 182 on the initial Cartesian trajectory, and passes themodified Cartesian trajectory to the Cartesian position controller 154.The Cartesian position controller 154 converts the modified Cartesiantrajectory to joint space, and passes a resulting joint space trajectoryto a joint position controller 156. This process is described in moredetail below with reference to FIG. 2 .

FIG. 2 is a flowchart of an example process for automatically avoidingsingular configurations at runtime. The process can be implemented byone or more computer programs installed on one or more computers in oneor more locations and programmed in accordance with this specification.For example, the offline part of the process can be performed by theoffline singular configuration computer 180 shown in FIG. 1 . Forconvenience, the process will be described as being performed by asystem of one or more computers.

The system obtains one or more singular configurations of the robot(210). In some embodiments, the singular configurations are computed bythe singular configuration computer 180 prior to execution. Inparticular, the singular configuration can be computed duringinitialization of the robot.

As shown on FIG. 3 , the robot 302 includes an arm 303 and an endeffector 305 at the end of the arm 303. The arm 303 includes a pluralityof joints 311-314. The end effector 305 can be a tool, such as a weldingdevice, spray gun, or a gripper. For a given robot, a configuration ofthe robot is defined by the angles of each of the joints 311-314 of therobot. The configuration of the robot determines the location of the endeffector 305. A given location of the end effector 305 may correspond toone or more configurations of the robot.

The location of the end effector 305 in the workcell 304 (orCartesian-space pose) can be defined by a set of Cartesian coordinatesin a Cartesian coordinate system (x, y, z). A Cartesian coordinatesystem for a three-dimensional space consists of three axes (x, y, z)that go through a common point, and are pairwise perpendicular. A set ofCartesian coordinates is a set of three numerical coordinates (x, y, z),which are the signed distances to the point from three axes, as well asthree rotational coordinates (rx, ry, rz) that define the robot endeffector orientation at the (x, y, z) coordinate. Kinematic equationsmap the joint parameters (e.g., angle) and the set of Cartesiancoordinates. The dimensions of the robot 302 and its kinematic equationsdefine the volume of the workcell 304, which is the space reachable bythe robot 302.

A singular configuration is a configuration of the joints in the robotthat severely limits control in one or more degrees of freedom. Variousmethods exist to mathematically derive singular configurations and whatis or is not considered one will depend on the method by which they arederived. In particular, singular configurations of the robot can beidentified based on its Jacobian. The Jacobian of the robot relates thejoint velocity to the linear and angular velocity of the end-effector.The Jacobian of the robot is computed by computing the time derivativeof the kinematic equations. The configurations where the Jacobian doesnot have an inverse are the singular configurations of the robot. Thedatabase of singular configurations 122 stores the singularconfigurations computed for the robot.

The system determines the location of the end effector 305 of the robotwhen the robot is in the singular configuration (220). In thespecification, the location of the end effector 305 when the robot is inthe singular configuration is called a singular point 310. A singularpoint 310 is defined by at least a set of joint Coordinates. A singularconfiguration can be defined by a set of Cartesian coordinates whenthere is only one Jacobian that satisfies the Cartesian-space pose.Depending on the kinematics, there could be multiple jointconfigurations corresponding to a Cartesian-space pose, where one ofthese joint configurations is further from singularity than other ones.In that case, a singular point 310 is defined by a set of Cartesiancoordinates, as well as the solution to the robot kinematic equations atthe set of Cartesian coordinates.

If a plurality of singular configurations have been identified, thesystem determines, for each singular configuration, the location of theend effector 305 when the robot is in that singular configuration. Eachsingular configuration defines a singular point 310. The singular point310 is the location of the end effector, when a singular point isdefined by a set of Cartesian coordinates. The singular point 310 is theset of joint coordinates, when a singular point is defined by a set ofCartesian coordinates and the solution to the kinematics equations atthe set of the Cartesian coordinates. 305. The database of singularconfigurations 122 stores the singular points 310 of the robot.

As shown in FIG. 2 , the system computes, for each voxel of a pluralityof voxels, a distance from the voxel to the location of the end effector305 when the robot is in the singular configuration (230). As shown onFIG. 3 , a representation of the workcell 304 is divided in an array ofdiscrete elements of volume. Each element of volume is a voxel 3 mn. Forevery voxel 3 mm in the workcell 304, the distance of the given voxel 3mn to the singular point is determined. Each voxel is mapped to itsdistance to the singular point. A distance from the voxel to thesingular point is computed for each of the plurality of singularconfigurations. Each voxel is mapped to its distance to the location ofthe nearest singular point 310. The resulting map is a potential fieldof the distance to the singular points.

As shown in FIG. 2 , the system computes a negative potential gradientof the computed distance to the singular points (240). As shown on FIG.4 , a negative potential gradient represents the inverse of how thedistance to the singular points 310 changes with position.

If the kinematic equations provide a bijective mapping between aCartesian-space pose and a joint configuration, the negative potentialgradient is, in the Cartesian space, the sum of the potential gradientsalong each Cartesian axis. The potential gradient along each Cartesianaxis is the local rate at which the distance to the singular points 310changes with position in the direction of the Cartesian axis. For eachvoxel, the local value of the negative potential gradient is a vector411-4 mn that represents the inverse of how the distance to the singularpoints 310 changes in the proximity of the voxel. In coordinates, thenegative potential gradient field can be represented as a vector-valuedfunction that associates a 3-tuple of real numbers to each voxel 3 mn ofthe workcell.

If the kinematic equations associate multiple joint configurations to aCartesian-space pose, the analysis for singular configurations isperformed for a given Cartesian-space pose and for a given kinematicjoint configuration that satisfies that Cartesian-space pose. In thatcase, the potential gradient is a function of the Cartesian-space poseand of the joint angles. Alternatively, a continuous collection of jointconfigurations that solve a Cartesian-space pose is discretized into arange of discrete solutions, and the analysis for singularconfigurations is performed over the range of discrete solutions.

As the distance from the singular configuration increases, the magnitudeof the negative potential gradient keeps on decreasing. A magnitude ofthe negative potential gradient can be inversely proportional to thedistance from the singular configurations. In the case of a singlesingular configuration in the workcell, vectors 411-4 mn point away fromthe singular configuration. In the case of multiple singularconfigurations in the workcell, each singular configuration acts as asource, with vectors 411-4 mn pointing away from the sources.

As shown in FIG. 2 , the system generates control rules to be followedby the robot during execution (250). The control rules are generatedbased on the negative potential gradient field. The control rules, whenfollowed by the robot, offset the trajectory of the robot according tothe negative potential gradient. The control rules ensure that thetrajectory of the robot avoids singular configurations. The controlrules can be stored in the singular configuration database 122.

In execution, the robot is controlled according to the control rules(260). This process is described in more detail below with reference toFIG. 6 .

As shown in FIG. 6 , the system (e.g., the singular configurationcontroller 152) accesses an initial Cartesian trajectory (610). Theinitial Cartesian trajectory is defined by a sequence of Cartesian-spaceposes. A Cartesian-space pose determines a location of the end effectorin the workcell in Cartesian space. A Cartesian-space pose can bedefined by a set of Cartesian coordinates.

In particular, the system can receive Cartesian goals. The Cartesiangoals can be received from the onsite execution engine 150 (e.g., froman online motion planner). In particular, the singular configurationcontroller 152 can receive a motion plan that defines a sequence ofCartesian goals that the robot must take to accomplish a task. The robotinterface subsystem 160 (e.g., the real-time software control system)generates an initial Cartesian trajectory based on the Cartesian goal.This initial Cartesian trajectory interpolates between the previouslyreceived Cartesian goal and the newly received Cartesian goal.

The system (e.g., the singular configuration controller 152) computes amodified Cartesian trajectory by enforcing the control rules on theinitial Cartesian trajectory (620). As shown on FIG. 5A, an initialtrajectory of the robot, according to a motion plan, passes through asingular point 310. As shown on FIG. 5B, the trajectory of the robot isoffset according to the negative potential gradient. EachCartesian-space pose of the initial Cartesian trajectory is displacedaccording to the local value of the negative potential gradient field411-4 mn. The local value of the negative potential gradient field 411-4mn is the vector defined by the value of the negative potential gradientin the voxel in which the Cartesian-space pose is located. Inparticular, the Cartesian-space pose is displaced in the direction ofthe local value of the negative potential gradient field 411-4 mn. Thedisplacement of the Cartesian-space pose in the direction of the localvalue of the negative potential gradient field 411-4 mn can beproportional to the magnitude of the local value of the negativepotential gradient field 411-4 mn. The resulting modified Cartesianposes define the modified Cartesian trajectory.

The system (e.g., the Cartesian position controller 154) computes ajoint space trajectory based on the modified Cartesian trajectory (630).The system converts the modified Cartesian trajectory to joint space. Tothat end, the system can use inverse kinematics solvers to compute thejoint space pose for a given Cartesian-space pose. The Cartesianposition controller 152 then passes the joint space poses to a jointposition controller 156.

The joint position controller 156 controls the robot according to thejoint position trajectory (640). In particular, the joint positioncontroller can be part of the software stack described below.

The enforcement of the control rules is not computationally expensiveand can therefore be done with real time constraints without introducingany significant delay. The singular configurations can thus beautomatically avoided during execution without introducing anysignificant delay. This improves the speed and reactivity of roboticoperations. The control rules allow even a robot with hard real-timeconstraints to dynamically account for and avoid singularconfigurations, even when computing singular configurations is notpossible at runtime.

FIG. 7 is a flowchart of another example process for automaticallyavoiding singular configurations at runtime. The process can beimplemented by one or more computer programs installed on one or morecomputers in one or more locations and programmed in accordance withthis specification. For example, the offline part of the process can beperformed by the offline singular configuration computer 180 shown inFIG. 1 . For convenience, the process will be described as beingperformed by a system of one or more computers.

The system obtains one or more singular configurations of the robot(710). The singular configurations can be obtained as described inrelation to FIG. 2 (e.g., 210).

The system computes, for each hypervoxel of a plurality of hypervoxels,a distance from the hypervoxel to the singular configuration (720). Arepresentation of the configuration space is divided in an array ofdiscrete elements of the N-dimensional space, wherein N is the number ofdegrees of freedom of the robot. The configuration space is the ensembleof all the configurations that the robot can take. Each discrete elementof the N-dimensional space is a hypervoxel. For every hypervoxel in theconfiguration space, the distance of the given hypervoxel to thesingular configuration is determined. Each hypervoxel is mapped to itsdistance to the singular configuration. A distance from the hypervoxelto the singular configuration is computed for each of the plurality ofsingular configurations. Each hypervoxel is mapped to its distance tothe nearest singular configuration. The resulting map is a potentialfield of the distance to the singular configurations.

The system computes a negative potential gradient of the computeddistance to the singular configurations (730). The negative potentialgradient represents the inverse of how the distance to the singularconfigurations changes with position in the configuration space.

For each hypervoxel, the local value of the negative potential gradientis a vector that represents the inverse of how the distance to thesingular configuration changes in the proximity of the hypervoxel. Inthe configuration space, the negative potential gradient field can berepresented as a vector-valued function that associates a N-tuple ofreal numbers to each hypervoxel of the workcell. As the distance fromthe singular configuration increases, the magnitude of the negativepotential gradient keeps on decreasing. A magnitude of the negativepotential gradient can be inversely proportional to the distance fromthe singular configurations.

The system generates control rules to be followed by the robot duringexecution (740). The control rules are generated based on the negativepotential gradient field. The control rules, when followed by the robot,offset the trajectory of the robot according to the negative potentialgradient. The control rules ensure that the trajectory of the robotavoids singular configurations. The control rules can be stored in thesingular configuration database 122.

In execution, the robot is controlled according to the control rules(750). This process is described in more details in relation to FIG. 8 .

As shown in FIG. 8 , the system (e.g., the Cartesian position controller154) accesses an initial Cartesian trajectory (810). The initialCartesian trajectory is defined by a sequence of Cartesian-space poses.A Cartesian-space pose determines a location of the end effector in theworkcell in Cartesian space. A Cartesian-space pose can be defined by aset of Cartesian coordinates.

In particular, the system can receive Cartesian goals. The Cartesiangoals can be received from the onsite execution engine 150 (e.g., froman online motion planner). In particular, the singular configurationcontroller 152 can receive a motion plan that defines a sequence ofCartesian goals that the robot must take to accomplish a task. The robotinterface subsystem 160 (e.g., the real-time software control system)generates an initial Cartesian trajectory based on the Cartesian goal.This initial Cartesian trajectory interpolates between the previouslyreceived Cartesian goal and the newly received Cartesian goal.

The system (e.g., the Cartesian position controller 154) computes aninitial joint space trajectory (820). The system converts the initialCartesian trajectory to joint space. This results in an initial jointspace trajectory. To that end, the system can use inverse kinematicssolvers to compute the Cartesian-space poses in joint space. TheCartesian position controller 154 then passes the initial joint spacetrajectory to the singular configuration controller 152.

The system (e.g., the singular configuration controller 152) computes amodified joint space trajectory by enforcing the control rules on theinitial joint space trajectory (830). If the initial joint spacetrajectory of the robot, according to a motion plan, passes through asingular configuration, the trajectory of the robot is offset accordingto the negative potential gradient. Each joint space pose of the initialjoint space trajectory is displaced according to the local value of thenegative potential gradient field. The local value of the negativepotential gradient field is the vector defined by the negative potentialgradient in the hypervoxel in which the joint space pose is located. Inparticular, the joint configuration pose is displaced in the directionof the local value of the negative potential gradient. The displacementof the joint configuration pose in the direction of the local value ofthe negative potential gradient field can be proportional to themagnitude of the local value of the negative potential gradient field.The resulting modified joint poses define a modified trajectory in jointspace. The singular configuration controller 152 then passes themodified joint space trajectory to a joint position controller 156.

The system (e.g., the joint position controller 156) controls the robotaccording to the modified joint space trajectory (840). In particular,the joint position controller can be part of the software stackdescribed below.

The enforcement of the control rules is not computationally expensiveand can therefore be done with real time constraints without introducingany significant delay. The singular configurations can thus beautomatically avoided during execution without introducing anysignificant delay. This improves the speed and reactivity of roboticoperations. The control rules allow even a robot with hard real-timeconstraints to dynamically account for and avoid singularconfigurations, even when computing singular configurations is notpossible at runtime.

In this specification, a robot is a machine having a base position, oneor more movable components, and a kinematic model that can be used tomap desired positions, poses, or both in one coordinate system, e.g.,Cartesian coordinates or joint angles, into commands for physicallymoving the one or more movable components to the desired positions orposes. In this specification, a tool is a device that is part of and isattached at the end of the kinematic chain of the one or more moveablecomponents of the robot. Example tools include grippers, weldingdevices, and sanding devices.

In this specification, a task is an operation to be performed by a tool.For brevity, when a robot has only one tool, a task can be described asan operation to be performed by the robot as a whole. Example tasksinclude welding, glue dispensing, part positioning, and surfacingsanding, to name just a few examples. Tasks are generally associatedwith a type that indicates the tool required to perform the task, aswell as a position within a workcell at which the task will beperformed.

In this specification, a motion plan is a data structure that providesinformation for executing a task, or a cluster of tasks. A motion plandefines a sequence of configurations that the robot can take toaccomplish the task. Motion plans can be fully constrained, meaning thatall values for all controllable degrees of freedom for the robot arerepresented explicitly or implicitly; or underconstrained, meaning thatsome values for controllable degrees of freedom are unspecified. In someimplementations, in order to actually perform a task corresponding to amotion plan, the motion plan must be fully constrained to include allnecessary values for all controllable degrees of freedom for the robot.Thus, at some points in the planning processes described in thisspecification, some motion plans may be underconstrained, but by thetime the motion plan is actually executed on a robot, the motion plancan be fully constrained.

In this specification, a transition is a motion plan that describes amovement to be performed between a start point and an end point. Thestart point and end point can be represented by poses, locations in acoordinate system, or tasks to be performed. Transitions can beunderconstrained by lacking one or more values of one or more respectivecontrollable degrees of freedom (DOF) for a robot. Some transitionsrepresent free motions. In this specification, a free motion is atransition in which none of the degrees of freedom are constrained. Forexample, a robot motion that simply moves from pose A to pose B withoutany restriction on how to move between these two poses is a free motion.During the planning process, the DOF variables for a free motion areeventually assigned values, and path planners can use any appropriatevalues for the motion that do not conflict with the physical constraintsof the workcell.

The robot functionalities described in this specification can beimplemented by a hardware-agnostic software stack, or, for brevity justa software stack, that is at least partially hardware-agnostic. In otherwords, the software stack can accept as input commands generated by theplanning processes described above without requiring the commands torelate specifically to a particular model of robot or to a particularrobotic component. For example, the software stack can be implemented atleast partially by the onsite execution engine 150 and the robotinterface subsystem 160 of FIG. 1 .

The software stack can include multiple levels of increasing hardwarespecificity in one direction and increasing software abstraction in theother direction. At the lowest level of the software stack are robotcomponents that include devices that carry out low-level actions andsensors that report low-level statuses. For example, robots can includea variety of low-level components including motors, encoders, cameras,drivers, grippers, application-specific sensors, linear or rotaryposition sensors, and other peripheral devices. As one example, a motorcan receive a command indicating an amount of torque that should beapplied. In response to receiving the command, the motor can report thecurrent position of a joint of the robot, e.g., using an encoder, to ahigher level of the software stack.

Each next highest level in the software stack can implement an interfacethat supports multiple different underlying implementations. In general,each interface between levels provides status messages from the lowerlevel to the upper level and provides commands from the upper level tothe lower level.

Typically, the commands and status messages are generated cyclicallyduring each control cycle, e.g., one status message and one command percontrol cycle. Lower levels of the software stack generally have tighterreal-time requirements than higher levels of the software stack. At thelowest levels of the software stack, for example, the control cycle canhave actual real-time requirements. In this specification, real-timemeans that a command received at one level of the software stack must beexecuted and optionally, that a status message be provided back to anupper level of the software stack, within a particular control cycletime. If this real-time requirement is not met, the robot can beconfigured to enter a fault state, e.g., by freezing all operation.

At a next-highest level, the software stack can include softwareabstractions of particular components, which will be referred to motorfeedback controllers. A motor feedback controller can be a softwareabstraction of any appropriate lower-level components and not just aliteral motor. A motor feedback controller thus receives state throughan interface into a lower-level hardware component and sends commandsback down through the interface to the lower-level hardware componentbased on upper-level commands received from higher levels in the stack.A motor feedback controller can have any appropriate control rules thatdetermine how the upper-level commands should be interpreted andtransformed into lower-level commands. For example, a motor feedbackcontroller can use anything from simple logical rules to more advancedmachine learning techniques to transform upper-level commands intolower-level commands. Similarly, a motor feedback controller can use anyappropriate fault rules to determine when a fault state has beenreached. For example, if the motor feedback controller receives anupper-level command but does not receive a lower-level status within aparticular portion of the control cycle, the motor feedback controllercan cause the robot to enter a fault state that ceases all operations.

At a next-highest level, the software stack can include actuatorfeedback controllers. An actuator feedback controller can includecontrol logic for controlling multiple robot components through theirrespective motor feedback controllers. For example, some robotcomponents, e.g., a joint arm, can actually be controlled by multiplemotors. Thus, the actuator feedback controller can provide a softwareabstraction of the joint arm by using its control logic to send commandsto the motor feedback controllers of the multiple motors.

At a next-highest level, the software stack can include joint feedbackcontrollers. A joint feedback controller can represent a joint that mapsto a logical degree of freedom in a robot. Thus, for example, while awrist of a robot might be controlled by a complicated network ofactuators, a joint feedback controller can abstract away that complexityand exposes that degree of freedom as a single joint. Thus, each jointfeedback controller can control an arbitrarily complex network ofactuator feedback controllers. As an example, a six degree-of-freedomrobot can be controlled by six different joint feedback controllers thateach control a separate network of actual feedback controllers.

Each level of the software stack can also perform enforcement oflevel-specific constraints. For example, if a particular torque valuereceived by an actuator feedback controller is outside of an acceptablerange, the actuator feedback controller can either modify it to bewithin range or enter a fault state.

To drive the input to the joint feedback controllers, the software stackcan use a command vector that includes command parameters for eachcomponent in the lower levels, e.g., a positive, torque, and velocity,for each motor in the system. To expose status from the joint feedbackcontrollers, the software stack can use a status vector that includesstatus information for each component in the lower levels, e.g., aposition, velocity, and torque for each motor in the system. In someimplementations, the command vectors also include some limit informationregarding constraints to be enforced by the controllers in the lowerlevels.

At a next-highest level, the software stack can include joint collectioncontrollers. A joint collection controller can handle issuing of commandand status vectors that are exposed as a set of part abstractions. Eachpart can include a kinematic model, e.g., for performing inversekinematic calculations, limit information, as well as a joint statusvector and a joint command vector. For example, a single jointcollection controller can be used to apply different sets of policies todifferent subsystems in the lower levels. The joint collectioncontroller can effectively decouple the relationship between how themotors are physically represented and how control policies areassociated with those parts. Thus, for example if a robot arm has amovable base, a joint collection controller can be used to enforce a setof limit policies on how the arm moves and to enforce a different set oflimit policies on how the movable base can move.

At a next-highest level, the software stack can include joint selectioncontrollers. A joint selection controller can be responsible fordynamically selecting between commands being issued from differentsources. In other words, a joint selection controller can receivemultiple commands during a control cycle and select one of the multiplecommands to be executed during the control cycle. The ability todynamically select from multiple commands during a real-time controlcycle allows greatly increased flexibility in control over conventionalrobot control systems.

At a next-highest level, the software stack can include joint positioncontrollers. A joint position controller can receive goal parameters anddynamically compute commands required to achieve the goal parameters.For example, a joint position controller can receive a position goal andcan compute a set point for achieving the goal.

At a next-highest level, the software stack can include Cartesianposition controllers and Cartesian selection controllers. A Cartesianposition controller can receive goals in Cartesian space as input anduse inverse kinematics solvers to compute an output in joint space. TheCartesian selection controller can then enforce limit policies on theresults computed by the Cartesian position controllers before passingthe computed results in joint space to a joint position controller inthe next lowest level of the stack. For example, a Cartesian positioncontroller can be given three separate goal states in Cartesiancoordinates x, y, and z. For some degrees, the goal state could be aposition, while for other degrees, the goal state could be a desiredvelocity.

These functionalities afforded by the software stack thus provide wideflexibility for control directives to be easily expressed as goal statesin a way that meshes naturally with the higher-level planning techniquesdescribed above. In other words, when the planning process uses aprocess definition graph to generate concrete actions to be taken, theactions need not be specified in low-level commands for individualrobotic components. Rather, they can be expressed as high-level goalsthat are accepted by the software stack that get translated through thevarious levels until finally becoming low-level commands. Moreover, theactions generated through the planning process can be specified inCartesian space in way that makes them understandable for humanoperators, which makes debugging and analyzing the schedules easier,faster, and more intuitive. In addition, the actions generated throughthe planning process need not be tightly coupled to any particular robotmodel or low-level command format. Instead, the same actions generatedduring the planning process can actually be executed by different robotmodels so long as they support the same degrees of freedom and theappropriate control levels have been implemented in the software stack.

Embodiments of the subject matter and the functional operationsdescribed in this specification can be implemented in digital electroniccircuitry, in tangibly-embodied computer software or firmware, incomputer hardware, including the structures disclosed in thisspecification and their structural equivalents, or in combinations ofone or more of them. Embodiments of the subject matter described in thisspecification can be implemented as one or more computer programs, i.e.,one or more modules of computer program instructions encoded on atangible non-transitory storage medium for execution by, or to controlthe operation of, data processing apparatus. The computer storage mediumcan be a machine-readable storage device, a machine-readable storagesubstrate, a random or serial access memory device, or a combination ofone or more of them. Alternatively or in addition, the programinstructions can be encoded on an artificially-generated propagatedsignal, e.g., a machine-generated electrical, optical, orelectromagnetic signal, that is generated to encode information fortransmission to suitable receiver apparatus for execution by a dataprocessing apparatus.

The term “data processing apparatus” refers to data processing hardwareand encompasses all kinds of apparatus, devices, and machines forprocessing data, including by way of example a programmable processor, acomputer, or multiple processors or computers. The apparatus can alsobe, or further include, special purpose logic circuitry, e.g., an FPGA(field programmable gate array) or an ASIC (application-specificintegrated circuit). The apparatus can optionally include, in additionto hardware, code that creates an execution environment for computerprograms, e.g., code that constitutes processor firmware, a protocolstack, a database management system, an operating system, or acombination of one or more of them.

A computer program which may also be referred to or described as aprogram, software, a software application, an app, a module, a softwaremodule, a script, or code) can be written in any form of programminglanguage, including compiled or interpreted languages, or declarative orprocedural languages, and it can be deployed in any form, including as astand-alone program or as a module, component, subroutine, or other unitsuitable for use in a computing environment. A program may, but neednot, correspond to a file in a file system. A program can be stored in aportion of a file that holds other programs or data, e.g., one or morescripts stored in a markup language document, in a single file dedicatedto the program in question, or in multiple coordinated files, e.g.,files that store one or more modules, sub-programs, or portions of code.A computer program can be deployed to be executed on one computer or onmultiple computers that are located at one site or distributed acrossmultiple sites and interconnected by a data communication network.

For a system of one or more computers to be configured to performparticular operations or actions means that the system has installed onit software, firmware, hardware, or a combination of them that inoperation cause the system to perform the operations or actions. For oneor more computer programs to be configured to perform particularoperations or actions means that the one or more programs includeinstructions that, when executed by data processing apparatus, cause theapparatus to perform the operations or actions.

As used in this specification, an “engine,” or “software engine,” refersto a software implemented input/output system that provides an outputthat is different from the input. An engine can be an encoded block offunctionality, such as a library, a platform, a software development kit(“SDK”), or an object. Each engine can be implemented on any appropriatetype of computing device, e.g., servers, mobile phones, tabletcomputers, notebook computers, music players, e-book readers, laptop ordesktop computers, PDAs, smart phones, or other stationary or portabledevices, that includes one or more processors and computer readablemedia. Additionally, two or more of the engines may be implemented onthe same computing device, or on different computing devices.

The processes and logic flows described in this specification can beperformed by one or more programmable computers executing one or morecomputer programs to perform functions by operating on input data andgenerating output. The processes and logic flows can also be performedby special purpose logic circuitry, e.g., an FPGA or an ASIC, or by acombination of special purpose logic circuitry and one or moreprogrammed computers.

Computers suitable for the execution of a computer program can be basedon general or special purpose microprocessors or both, or any other kindof central processing unit. Generally, a central processing unit willreceive instructions and data from a read-only memory or a random accessmemory or both. The essential elements of a computer are a centralprocessing unit for performing or executing instructions and one or morememory devices for storing instructions and data. The central processingunit and the memory can be supplemented by, or incorporated in, specialpurpose logic circuitry. Generally, a computer will also include, or beoperatively coupled to receive data from or transfer data to, or both,one or more mass storage devices for storing data, e.g., magnetic,magneto-optical disks, or optical disks. However, a computer need nothave such devices. Moreover, a computer can be embedded in anotherdevice, e.g., a mobile telephone, a personal digital assistant (PDA), amobile audio or video player, a game console, a Global PositioningSystem (GPS) receiver, or a portable storage device, e.g., a universalserial bus (USB) flash drive, to name just a few.

Computer-readable media suitable for storing computer programinstructions and data include all forms of non-volatile memory, mediaand memory devices, including by way of example semiconductor memorydevices, e.g., EPROM, EEPROM, and flash memory devices; magnetic disks,e.g., internal hard disks or removable disks; magneto-optical disks; andCD-ROM and DVD-ROM disks.

To provide for interaction with a user, embodiments of the subjectmatter described in this specification can be implemented on a computerhaving a display device, e.g., a CRT (cathode ray tube) or LCD (liquidcrystal display) monitor, for displaying information to the user and akeyboard and pointing device, e.g., a mouse, trackball, or a presencesensitive display or other surface by which the user can provide inputto the computer. Other kinds of devices can be used to provide forinteraction with a user as well; for example, feedback provided to theuser can be any form of sensory feedback, e.g., visual feedback,auditory feedback, or tactile feedback; and input from the user can bereceived in any form, including acoustic, speech, or tactile input. Inaddition, a computer can interact with a user by sending documents toand receiving documents from a device that is used by the user; forexample, by sending web pages to a web browser on a user's device inresponse to requests received from the web browser. Also, a computer caninteract with a user by sending text messages or other forms of messageto a personal device, e.g., a smartphone, running a messagingapplication, and receiving responsive messages from the user in return.

Embodiments of the subject matter described in this specification can beimplemented in a computing system that includes a back-end component,e.g., as a data server, or that includes a middleware component, e.g.,an application server, or that includes a front-end component, e.g., aclient computer having a graphical user interface, a web browser, or anapp through which a user can interact with an implementation of thesubject matter described in this specification, or any combination ofone or more such back-end, middleware, or front-end components. Thecomponents of the system can be interconnected by any form or medium ofdigital data communication, e.g., a communication network. Examples ofcommunication networks include a local area network (LAN) and a widearea network (WAN), e.g., the Internet.

The computing system can include clients and servers. A client andserver are generally remote from each other and typically interactthrough a communication network. The relationship of client and serverarises by virtue of computer programs running on the respectivecomputers and having a client-server relationship to each other. In someembodiments, a server transmits data, e.g., an HTML page, to a userdevice, e.g., for purposes of displaying data to and receiving userinput from a user interacting with the device, which acts as a client.Data generated at the user device, e.g., a result of the userinteraction, can be received at the server from the device.

In addition to the embodiments of the attached embodiments and theembodiments described above, the following embodiments are alsoinnovative:

Embodiment 1 is a computer-implemented method comprising:

obtaining a singular configuration of a robot;

determining a location of an end effector of the robot when the robot isin the singular configuration;

for each of a plurality of voxels in a workcell, computing a distancefrom the voxel to the location of the end effector when the robot is inthe singular configuration;

computing a negative potential gradient of the computed distance; and

generating control rules to be followed by the robot, wherein thecontrol rules, when followed by the robot, offset the trajectory of therobot according to the negative potential gradient.

Embodiment 2 is the method of embodiment 1, further comprisingcontrolling the robot according to the control rules.

Embodiment 3 is the method of embodiment 2, wherein controlling therobot according to the control rules comprises:

accessing an initial Cartesian trajectory comprising a sequence ofCartesian-space poses in Cartesian space;

for each Cartesian-space pose of the sequence:

-   -   computing a modified Cartesian-space pose by enforcing the        control rules on the Cartesian-space pose; and    -   computing a joint-space pose in joint space by applying inverse        kinematic to the modified Cartesian-space pose; and

controlling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by the sequence of joint-spaceposes.

Embodiment 4 is the method of embodiment 3, wherein computing themodified Cartesian-space pose comprises displacing the Cartesian-spacepose in a local direction of the negative potential gradient.

Embodiment 5 is the method of embodiment 3, wherein computing themodified Cartesian-space pose comprises displacing the Cartesian-spacepose in a local direction of the negative gradient by a distanceproportional to a local magnitude of the negative potential gradient.

Embodiment 6 is the method of any of embodiments 1-5, wherein obtainingthe singular configuration of the robot comprises computing the singularconfiguration of the robot.

Embodiment 7 is the method of embodiment 6, wherein computing thesingular configuration of the robot comprises computing a plurality ofsingular configurations of the robot;

and wherein computing the distance from the voxel to the location of theend effector when the robot is in the singular configuration comprises:

-   -   for each of the plurality of singular configurations, computing        a distance from the voxel to the location of the end effector        when the robot is in the singular configuration; and    -   mapping each voxel to the distance from the voxel to the        location of the nearest location of the end effector that        corresponds to one of the singular configurations.

Embodiment 8 is the method of embodiment 6, wherein computing thesingular configuration of the robot comprises:

computing the Jacobian matrix of the robot, the Jacobian matrix of therobot being computed by computing a time derivative of kinematicequations of the robot;

identifying a configuration of the robot where the Jacobian matrix doesnot have an inverse as the singular configuration of the robot.

Embodiment 9 is the method of embodiment 8, wherein the robot comprisesa plurality of joints, and wherein the configuration of the robot isdefined by an angle of each of the joints of the robot.

Embodiment 10 is the method of any of embodiments 1 to 9, wherein thesingular configuration is obtained from a pre-generated database ofsingular configurations computed for a particular robot model.

Embodiment 11 is a computer-implemented method for controlling a robotat runtime, the method comprising:

accessing a Cartesian trajectory comprising a sequence ofCartesian-space poses in Cartesian space;

for each Cartesian-space pose of the sequence:

-   -   computing a modified Cartesian-space pose by enforcing control        rules on the Cartesian-space pose, wherein enforcing the control        rules on the Cartesian-space pose comprises offsetting the        Cartesian-space pose according to a negative potential gradient        of a distance from the Cartesian-space pose to a location of an        end effector of the robot when the robot is in a singular        configuration; and    -   computing a joint-space pose in joint space by applying inverse        kinematic to the modified Cartesian-space pose; and

controlling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by the sequence of joint-spaceposes.

Embodiment 12 is the method of embodiment 11, wherein computing themodified Cartesian-space pose comprises displacing the Cartesian-spacepose in a local direction of the negative potential gradient.

Embodiment 13 is the method of embodiment 11, wherein computing themodified Cartesian-space pose comprises displacing the Cartesian-spacepose in a local direction of the negative gradient by a distanceproportional to a local magnitude of the negative potential gradient.

Embodiment 14 is a computer-implemented method comprising:

obtaining a singular configuration of a robot;

for each of a plurality of hypervoxels in a workcell, computing adistance from the hypervoxel to the singular configuration;

computing a negative potential gradient of the computed distance; and

generating control rules to be followed by the robot, wherein thecontrol rules, when followed by the robot, offset the trajectory of therobot according to the negative potential gradient.

Embodiment 15 is the method of embodiment 14, further comprisingcontrolling the robot according to the control rules.

Embodiment 16 is the method of embodiment 15, wherein controlling therobot according to the control rules comprises:

accessing an initial Cartesian trajectory comprising a sequence ofinitial Cartesian-space poses in Cartesian space;

for each initial Cartesian-space pose of the sequence:

-   -   computing an initial joint-space pose in joint space by applying        inverse kinematic to the initial Cartesian-space pose; and    -   computing a modified joint-space pose by enforcing the control        rules on the initial joint-space pose; and

controlling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by the sequence of the modifiedjoint-space poses.

Embodiment 17 is the method of embodiment 16, wherein computing themodified joint-space pose comprises displacing the modified joint-spacepose in a local direction of the negative gradient by a distanceproportional to a local magnitude of the negative potential gradient.

Embodiment 18 is the method of any of embodiments 14 to 17, wherein therobot comprises a plurality of joints, and wherein each of thehypervoxels in the workcell is a discrete element of a configurationspace, wherein the configuration space is an ensemble of a plurality ofconfigurations that the robot can take, and wherein each of theplurality of configurations is defined by an angle of each of the jointsof the robot.

Embodiment 19 is a computer-implemented method for controlling a robotat runtime, the method comprising:

accessing an initial Cartesian trajectory comprising a sequence ofinitial Cartesian-space poses in Cartesian space;

for each initial Cartesian-space pose of the sequence:

-   -   computing an initial joint-space pose in joint space by applying        inverse kinematic to the initial Cartesian-space pose; and    -   computing a modified joint-space pose by enforcing control rules        on the initial joint-space pose, wherein enforcing the control        rules on the initial joint-space pose comprises offsetting the        initial joint-space pose according to a negative potential        gradient of a distance from the initial joint-space pose to a        singular configuration; and

controlling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by the sequence of modifiedjoint-space poses.

Embodiment 20 is the method of embodiment 19, wherein computing themodified joint-space pose comprises displacing the initial joint-spacepose in a local direction of the negative gradient by a distanceproportional to a local magnitude of the negative potential gradient.

Embodiment 21 is a system comprising: one or more computers and one ormore storage devices storing instructions that are operable, whenexecuted by the one or more computers, to cause the one or morecomputers to perform the method of any one of embodiments 1 to 20.

Embodiment 22 is a computer storage medium encoded with a computerprogram, the program comprising instructions that are operable, whenexecuted by data processing apparatus, to cause the data processingapparatus to perform the method of any one of embodiments 1 to 20.

While this specification contains many specific implementation details,these should not be construed as limitations on the scope of anyinvention or on the scope of what may be claimed, but rather asdescriptions of features that may be specific to particular embodimentsof particular inventions. Certain features that are described in thisspecification in the context of separate embodiments can also beimplemented in combination in a single embodiment. Conversely, variousfeatures that are described in the context of a single embodiment canalso be implemented in multiple embodiments separately or in anysuitable subcombination. Moreover, although features may be describedabove as acting in certain combinations and even initially be claimed assuch, one or more features from a claimed combination can in some casesbe excised from the combination, and the claimed combination may bedirected to a subcombination or variation of a subcombination.

Similarly, while operations are depicted in the drawings in a particularorder, this should not be understood as requiring that such operationsbe performed in the particular order shown or in sequential order, orthat all illustrated operations be performed, to achieve desirableresults. In certain circumstances, multitasking and parallel processingmay be advantageous. Moreover, the separation of various system modulesand components in the embodiments described above should not beunderstood as requiring such separation in all embodiments, and itshould be understood that the described program components and systemscan generally be integrated together in a single software product orpackaged into multiple software products.

Particular embodiments of the subject matter have been described. Otherembodiments are within the scope of the following claims. For example,the actions recited in the claims can be performed in a different orderand still achieve desirable results. As one example, the processesdepicted in the accompanying figures do not necessarily require theparticular order shown, or sequential order, to achieve desirableresults. In certain some cases, multitasking and parallel processing maybe advantageous.

What is claimed is:
 1. A computer-implemented method comprising:obtaining a singular configuration of a robot; determining a location ofan end effector of the robot when the robot is in the singularconfiguration; for each of a plurality of voxels in a workcell,computing a respective distance from the voxel to the location of theend effector when the robot is in the singular configuration; computinga negative potential gradient of the computed distance, wherein amagnitude of the negative potential gradient is inversely proportionalto the distance from the singular configuration; and generating controlrules to be followed by the robot, wherein the control rules, whenfollowed by the robot, cause the robot to avoid the singularconfiguration by offsetting a trajectory of the robot according to therespective negative potential gradients of the voxels through which therobot end effector travels.
 2. The method of claim 1, further comprisingcontrolling the robot according to the control rules.
 3. The method ofclaim 2, wherein controlling the robot according to the control rulescomprises: accessing an initial Cartesian trajectory comprising asequence of initial Cartesian-space poses in Cartesian space; for eachinitial Cartesian-space pose of the sequence: computing a modifiedCartesian-space pose by enforcing the control rules on the initialCartesian-space pose; and computing a joint-space pose in joint space byapplying inverse kinematic to the modified Cartesian-space pose; andcontrolling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by a sequence of the computedjoint-space poses.
 4. The method of claim 3, wherein computing themodified Cartesian-space pose comprises displacing the initialCartesian-space pose in a local direction of the negative potentialgradient.
 5. The method of claim 3, wherein computing the modifiedCartesian-space pose comprises displacing the initial Cartesian-spacepose in a local direction of the negative potential gradient by adistance proportional to a local magnitude of the negative potentialgradient.
 6. The method of claim 1, wherein obtaining the singularconfiguration of the robot comprises computing the singularconfiguration of the robot.
 7. The method of claim 6, wherein computingthe singular configuration of the robot comprises computing a pluralityof singular configurations of the robot; and wherein computing therespective distance from a voxel to the location of the end effectorwhen the robot is in the singular configuration comprises: for each ofthe plurality of singular configurations, computing a distance from thevoxel to the location of the end effector when the robot is in thesingular configuration; and mapping each voxel to the distance from thevoxel to the location of a nearest location of the end effector thatcorresponds to one of the singular configurations.
 8. The method ofclaim 6, wherein computing the singular configuration of the robotcomprises: computing a Jacobian matrix of the robot, the Jacobian matrixof the robot being computed by computing a time derivative of kinematicequations of the robot; and identifying a configuration of the robotwhere the Jacobian matrix does not have an inverse as the singularconfiguration of the robot.
 9. The method of claim 8, wherein the robotcomprises a plurality of joints, and wherein the configuration of therobot is defined by an angle of each of the joints of the robot.
 10. Themethod of claim 1, wherein the singular configuration is obtained from apre-generated database of singular configurations computed for aparticular robot model.
 11. A computer-implemented method forcontrolling a robot at runtime, the method comprising: accessing aninitial Cartesian trajectory comprising a sequence of initialCartesian-space poses in Cartesian space; for each initialCartesian-space pose of the sequence: computing a modifiedCartesian-space pose by enforcing control rules on the initialCartesian-space pose, wherein enforcing the control rules on the initialCartesian-space pose comprises offsetting the initial Cartesian-spacepose according to a negative potential gradient of a distance from theinitial Cartesian-space pose to a location of an end effector of therobot when the robot is in a singular configuration, wherein a magnitudeof the negative potential gradient is inversely proportional to thedistance; and computing a joint-space pose in joint space by applyinginverse kinematic to the modified Cartesian-space pose; and controllingthe robot according to a joint position trajectory, wherein the jointposition trajectory is defined by a sequence of the computed joint-spaceposes.
 12. The method of claim 11, wherein computing the modifiedCartesian-space pose comprises displacing the initial Cartesian-spacepose in a local direction of the negative potential gradient.
 13. Themethod of claim 11, wherein computing the modified Cartesian-space posecomprises displacing the initial Cartesian-space pose in a localdirection of the negative potential gradient by a distance proportionalto a local magnitude of the negative potential gradient.
 14. Acomputer-implemented method comprising: obtaining a singularconfiguration of a robot; for each of a plurality of hypervoxels in aworkcell, computing a respective distance from the hypervoxel to thesingular configuration; computing a negative potential gradient of thecomputed distance, wherein a magnitude of the negative potentialgradient is inversely proportional to the distance from the hypervoxelto the singular configuration; and generating control rules to befollowed by the robot, wherein the control rules, when followed by therobot, cause the robot to avoid the singular configuration by offsettinga trajectory of the robot according to the respective negative potentialgradients of the hypervoxels.
 15. The method of claim 14, furthercomprising controlling the robot according to the control rules.
 16. Themethod of claim 15, wherein controlling the robot according to thecontrol rules comprises: accessing an initial Cartesian trajectorycomprising a sequence of initial Cartesian-space poses in Cartesianspace; for each initial Cartesian-space pose of the sequence: computingan initial joint-space pose in joint space by applying inverse kinematicto the initial Cartesian-space pose; and computing a modifiedjoint-space pose by enforcing the control rules on the initialjoint-space pose; and controlling the robot according to a jointposition trajectory, wherein the joint position trajectory is defined bya sequence of the computed modified joint-space poses.
 17. The method ofclaim 16, wherein computing the modified joint-space pose comprisesdisplacing the modified joint-space pose in a local direction of thenegative potential gradient by a distance proportional to a localmagnitude of the negative potential gradient.
 18. The method of claim14, wherein the robot comprises a plurality of joints, and wherein eachof the hypervoxels in the workcell is a discrete element of aconfiguration space, wherein the configuration space is an ensemble of aplurality of configurations that the robot can take, and wherein each ofthe plurality of configurations is defined by an angle of each of thejoints of the robot.
 19. A computer-implemented method for controlling arobot at runtime, the method comprising: accessing an initial Cartesiantrajectory comprising a sequence of initial Cartesian-space poses inCartesian space; for each initial Cartesian-space pose of the sequence:computing an initial joint-space pose in joint space by applying inversekinematic to the initial Cartesian-space pose; and computing a modifiedjoint-space pose by enforcing control rules on the initial joint-spacepose, wherein enforcing the control rules on the initial joint-spacepose comprises offsetting the initial joint-space pose according to anegative potential gradient of a distance from the initial joint-spacepose to a singular configuration, wherein a magnitude of the negativepotential gradient is inversely proportional to the distance; andcontrolling the robot according to a joint position trajectory, whereinthe joint position trajectory is defined by a sequence of the computedmodified joint-space poses.
 20. The method of claim 19, whereincomputing the modified joint-space pose comprises displacing the initialjoint-space pose in a local direction of the negative potential gradientby a distance proportional to a local magnitude of the negativepotential gradient.
 21. A computing system comprising a plurality ofcomputers and one or more storage devices storing instructions that areoperable, when executed by the plurality of computers, to cause theplurality of computers perform operations comprising: obtaining asingular configuration of a robot; determining a location of an endeffector of the robot when the robot is in the singular configuration;for each of a plurality of voxels in a workcell, computing a respectivedistance from the voxel to the location of the end effector when therobot is in the singular configuration; computing a negative potentialgradient of the computed distance, wherein a magnitude of the negativepotential gradient is inversely proportional to the distance from thesingular configuration; and generating control rules to be followed bythe robot, wherein the control rules, when followed by the robot, causethe robot to avoid the singular configuration by offsetting a trajectoryof the robot according to the respective negative potential gradients ofthe voxels through which the robot end effector travels.
 22. One or morenon-transitory computer storage media encoded with computer programinstructions that when executed by a distributed system comprising aplurality of computers cause the plurality of computers to performoperations comprising: obtaining a singular configuration of a robot;determining a location of an end effector of the robot when the robot isin the singular configuration; for each of a plurality of voxels in aworkcell, computing a respective distance from the voxel to the locationof the end effector when the robot is in the singular configuration;computing a negative potential gradient of the computed distance,wherein a magnitude of the negative potential gradient is inverselyproportional to the distance from the singular configuration; andgenerating control rules to be followed by the robot, wherein thecontrol rules, when followed by the robot, cause the robot to avoid thesingular configuration by offsetting a trajectory of the robot accordingto the respective negative potential gradients of the voxels throughwhich the robot end effector travels.
 23. A computing system comprisinga plurality of computers and one or more storage devices storinginstructions that are operable, when executed by the plurality ofcomputers, to cause the plurality of computers perform operationscomprising: accessing an initial Cartesian trajectory comprising asequence of initial Cartesian-space poses in Cartesian space; for eachinitial Cartesian-space pose of the sequence: computing a modifiedCartesian-space pose by enforcing control rules on the initialCartesian-space pose, wherein enforcing the control rules on the initialCartesian-space pose comprises offsetting the initial Cartesian-spacepose according to a negative potential gradient of a distance from theinitial Cartesian-space pose to a location of an end effector of a robotwhen the robot is in a singular configuration, wherein a magnitude ofthe negative potential gradient is inversely proportional to thedistance; and computing a joint-space pose in joint space by applyinginverse kinematic to the modified Cartesian-space pose; and controllingthe robot according to a joint position trajectory, wherein the jointposition trajectory is defined by a sequence of the computed joint-spaceposes.
 24. One or more non-transitory computer storage media encodedwith computer program instructions that when executed by a distributedsystem comprising a plurality of computers cause the plurality ofcomputers to perform operations comprising: accessing an initialCartesian trajectory comprising a sequence of initial Cartesian-spaceposes in Cartesian space; for each initial Cartesian-space pose of thesequence: computing a modified Cartesian-space pose by enforcing controlrules on the initial Cartesian-space pose, wherein enforcing the controlrules on the initial Cartesian-space pose comprises offsetting theinitial Cartesian-space pose according to a negative potential gradientof a distance from the initial Cartesian-space pose to a location of anend effector of a robot when the robot is in a singular configuration,wherein a magnitude of the negative potential gradient is inverselyproportional to the distance; and computing a joint-space pose in jointspace by applying inverse kinematic to the modified Cartesian-spacepose; and controlling the robot according to a joint positiontrajectory, wherein the joint position trajectory is defined by asequence of the computed joint-space poses.
 25. A computing systemcomprising a plurality of computers and one or more storage devicesstoring instructions that are operable, when executed by the pluralityof computers, to cause the plurality of computers perform operationscomprising: obtaining a singular configuration of a robot; for each of aplurality of hypervoxels in a workcell, computing a respective distancefrom the hypervoxel to the singular configuration; computing a negativepotential gradient of the computed distance, wherein a magnitude of thenegative potential gradient is inversely proportional to the distancefrom the hypervoxel to the singular configuration; and generatingcontrol rules to be followed by the robot, wherein the control rules,when followed by the robot, cause the robot to avoid the singularconfiguration by offsetting a trajectory of the robot according to therespective negative potential gradients of the hypervoxels.
 26. One ormore non-transitory computer storage media encoded with computer programinstructions that when executed by a distributed system comprising aplurality of computers cause the plurality of computers to performoperations comprising: obtaining a singular configuration of a robot;for each of a plurality of hypervoxels in a workcell, computing arespective distance from the hypervoxel to the singular configuration;computing a negative potential gradient of the computed distance,wherein a magnitude of the negative potential gradient is inverselyproportional to the distance from the hypervoxel to the singularconfiguration; and generating control rules to be followed by the robot,wherein the control rules, when followed by the robot, cause the robotto avoid the singular configuration by offsetting a trajectory of therobot according to the respective negative potential gradients of thehypervoxels.
 27. A computing system comprising a plurality of computersand one or more storage devices storing instructions that are operable,when executed by the plurality of computers, to cause the plurality ofcomputers perform operations comprising: accessing an initial Cartesiantrajectory comprising a sequence of initial Cartesian-space poses inCartesian space; for each initial Cartesian-space pose of the sequence:computing an initial joint-space pose in joint space by applying inversekinematic to the initial Cartesian-space pose; and computing a modifiedjoint-space pose by enforcing control rules on the initial joint-spacepose, wherein enforcing the control rules on the initial joint-spacepose comprises offsetting the initial joint-space pose according to anegative potential gradient of a distance from the initial joint-spacepose to a singular configuration, wherein a magnitude of the negativepotential gradient is inversely proportional to the distance; andcontrolling a robot according to a joint position trajectory, whereinthe joint position trajectory is defined by a sequence of the computedmodified joint-space poses.
 28. One or more non-transitory computerstorage media encoded with computer program instructions that whenexecuted by a distributed system comprising a plurality of computerscause the plurality of computers to perform operations comprising:accessing an initial Cartesian trajectory comprising a sequence ofinitial Cartesian-space poses in Cartesian space; for each initialCartesian-space pose of the sequence: computing an initial joint-spacepose in joint space by applying inverse kinematic to the initialCartesian-space pose; and computing a modified joint-space pose byenforcing control rules on the initial joint-space pose, whereinenforcing the control rules on the initial joint-space pose comprisesoffsetting the initial joint-space pose according to a negativepotential gradient of a distance from the initial joint-space pose to asingular configuration, wherein a magnitude of the negative potentialgradient is inversely proportional to the distance; and controlling arobot according to a joint position trajectory, wherein the jointposition trajectory is defined by a sequence of the computed modifiedjoint-space poses.